<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <div id="nowtime"></div>
    <script>
    //得到当前的时间
    function showtime(){
     var now=new Date();
     var year=now.getFullYear();
     var month=now.getMonth();
     var date= now.getDate();
     var hour=now.getHours();
     var minutes=now.getUTCMinutes();
     var seconds=now.getSeconds();
     var milliseconds=now.getMilliseconds();
     var time=now.getTime();
     var nowtime=document.getElementById('nowtime');
     nowtime.innerHTML=year+'年'+(month+1)+'月'+date
     +'日'+hour+'时'+minutes+'分'+seconds+'秒';
}

    setInterval(showtime,1000);
    </script>
</body>
</html>